package com.cershy.chatroomserver.utils;

import org.springframework.stereotype.Component;

@Component
public class GroupIdGenerator {

    private final SnowflakeIdGenerator snowflakeIdGenerator;

    public GroupIdGenerator() {
        // Node ID 可以根据当前服务器/实例配置为不同值（例如 0 ~ 1023）
        this.snowflakeIdGenerator = new SnowflakeIdGenerator(1);
    }

    public String generateGroupId() {
        return "group_" + snowflakeIdGenerator.nextId();
    }
}
